/* 全局样式重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f5f5f5;
}

#root {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 视频元素样式 */
video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  background-color: #000;
}

/* 本地视频样式 */
.local-video {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  border: 2px solid #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10;
  cursor: pointer;
  transition: all 0.3s ease;
}

.local-video:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* 远程视频样式 */
.remote-video {
  width: 100%;
  height: 100%;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 控制面板样式 */
.control-panel {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50px;
  backdrop-filter: blur(10px);
  z-index: 20;
}

.control-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 24px;
}

.control-button:hover {
  transform: scale(1.1);
}

.control-button.mute {
  background-color: #f44336;
  color: white;
}

.control-button.unmute {
  background-color: #4caf50;
  color: white;
}

.control-button.video-off {
  background-color: #f44336;
  color: white;
}

.control-button.video-on {
  background-color: #4caf50;
  color: white;
}

.control-button.hangup {
  background-color: #f44336;
  color: white;
}

/* 加载动画 */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 房间信息样式 */
.room-info {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

/* 错误提示样式 */
.error-message {
  background-color: #f44336;
  color: white;
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  text-align: center;
}

.success-message {
  background-color: #4caf50;
  color: white;
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  text-align: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .local-video {
    width: 120px;
    height: 90px;
    top: 10px;
    right: 10px;
  }
  
  .control-panel {
    bottom: 20px;
    gap: 12px;
    padding: 12px 20px;
  }
  
  .control-button {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  
  .room-info {
    top: 10px;
    left: 10px;
    padding: 8px 12px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .local-video {
    width: 100px;
    height: 75px;
  }
  
  .control-panel {
    gap: 8px;
    padding: 8px 16px;
  }
  
  .control-button {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
}

/* 连接状态指示器 */
.connection-status {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10;
}

.connection-status.connected {
  background-color: #4caf50;
  color: white;
}

.connection-status.connecting {
  background-color: #ff9800;
  color: white;
}

.connection-status.disconnected {
  background-color: #f44336;
  color: white;
}

/* 工具提示样式 */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 焦点样式 */
button:focus,
input:focus,
select:focus {
  outline: 2px solid #1976d2;
  outline-offset: 2px;
}

/* 禁用状态样式 */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 动画效果 */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}